package cn.com.greatwall.kafka.domain.vo;

import lombok.Data;

/**
 * @Author herw
 * @Time 2021-04-06 14:36:33
 * @Version 1.0
 * @Description: TODO(用一句话描述该文件做什么)
 */
@Data
public class PartitionAssignmentState {
    private String group;
    private String topic;
    private int partition;
    private long offset;
    private long lag;
    private String consumerId;
    private String host;
    private String clientId;
    private long logEndOffset;
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((group == null) ? 0 : group.hashCode());
        result = prime * result + partition;
        result = prime * result + ((topic == null) ? 0 : topic.hashCode());
        return result;
    }
    
    @Override
    public boolean equals(Object obj) {
        if(this == obj) {
            return true;
        }
        if(obj == null || getClass() != obj.getClass()) {
            return false;
        }
        PartitionAssignmentState state = (PartitionAssignmentState) obj;
        if (group == null) {
            if (state.group != null) {
                return false;
            }
        } else if (!group.equals(state.group)) {
            return false;
        }
        if (partition != state.partition) {
            return false;
        }
        if (topic == null) {
            return state.topic == null;
        } else {
            return topic.equals(state.topic);
        }
    }
}
